package com.itheima.anno;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;

@Component("myAspect")
@Aspect
public class MyAspect {

    @Before("execution(public void com.itheima.anno.*.*(..))")
    public void before(){
        System.out.println("MyAspect.before...");
    }

    public void after(){
        System.out.println("MyAspect.after...");
    }

    public Object around(ProceedingJoinPoint pjp) throws Throwable {
        System.out.println("around-before");
        Object proceed = pjp.proceed();
        System.out.println("around-after");
        return proceed;
    }

    public void afterThrowing(){
        System.out.println("异常...");
    }
}
